import time
def bubble_sort(arr: list):
    n = len(arr) - 1
    for i in range(0, n):
        for j in range(0, n - i):
            if arr[j] > arr[j + 1]:
                arr[j], arr[j + 1] = arr[j + 1], arr[j]
    return arr

def run(fname: str):
    arr = []
    f = open(fname)
    for line in f.readlines():
        arr.append(int(line.replace("\n", "")))
    f.close()
    start = time.time()
    arr = bubble_sort(arr)
    print(fname.replace(".txt", ""), int((time.time() - start) * 1000), "milliseconds")

run("m1_sorted.txt")
run("m2_reverse.txt")
run("m3_shuffle.txt")
